﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Cms/Admin.Master" AutoEventWireup="true"
    CodeBehind="CommentMan.aspx.cs" Inherits="Aij1.Cms.CommentMan" %>

<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Web.v13.1, Version=13.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dx" %>
<%@ Register Assembly="DevExpress.Xpo.v13.1.Web, Version=13.1.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Xpo" TagPrefix="dx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">
        function btnNew_Click(s, e) {
            grid.AddNewRow();
        }

        function btnDelete_Click(s, e) {
            var selkeys = grid.GetSelectedKeysOnPage().join(',');
            if (selkeys.length > 0 && confirm("确认删除?")) {
                grid.PerformCallback('del:' + selkeys);
            }
        }

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PH" runat="server">
    <table class="style1">
        <tr>
            <td width="120">
                <dx:ASPxButton ID="btnNew" runat="server" Text="新增" AutoPostBack="False">
                    <ClientSideEvents Click="btnNew_Click" />
                </dx:ASPxButton>
            </td>
            <td width="120">
                <dx:ASPxButton ID="btnDelete" runat="server" Text="批量删除" AutoPostBack="False" ClientInstanceName="btnDelete">
                    <ClientSideEvents Click="btnDelete_Click" />
                </dx:ASPxButton>
            </td>
            <td width="120">
                &nbsp;
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
    </table>
    <dx:ASPxGridView ID="GV" runat="server" AutoGenerateColumns="False" DataSourceID="XpoDataSource1"
        ClientInstanceName="grid" KeyFieldName="Oid" PreviewFieldName="Comment" Width="100%"
        OnCustomCallback="GV_CustomCallback">
        <Columns>
            <dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0" Width="30px">
                <CellStyle HorizontalAlign="Center">
                </CellStyle>
                <HeaderTemplate>
                    <dx:ASPxCheckBox ID="SelectAllCheckBox" runat="server" ToolTip="全选/全不选本页所有行" ClientSideEvents-CheckedChanged="function(s, e) { grid.SelectAllRowsOnPage(s.GetChecked()); }" />
                </HeaderTemplate>
                <HeaderStyle HorizontalAlign="Center" />
                <CellStyle HorizontalAlign="Center" />
            </dx:GridViewCommandColumn>
            <dx:GridViewDataTextColumn Caption="编号" FieldName="Oid" ReadOnly="True" VisibleIndex="1"
                Width="50px">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn Caption="文章" FieldName="ArticleId.Title" VisibleIndex="2">
                <DataItemTemplate>
                    <a href='../News.aspx?Id=<%#Eval("ArticleId!Key") %>' target="_blank"><%#Container.Text%></a>
                </DataItemTemplate>
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn Caption="评论人" FieldName="EditorId.SysName" VisibleIndex="3"
                Width="110px">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataDateColumn Caption="时间" FieldName="EditTime" VisibleIndex="4" Width="110px">
                <PropertiesDateEdit DisplayFormatString="yyyy-MM-dd HH:mm">
                </PropertiesDateEdit>
                <CellStyle HorizontalAlign="Center">
                </CellStyle>
            </dx:GridViewDataDateColumn>
            <dx:GridViewCommandColumn Caption="操作" VisibleIndex="6" Width="50px">
                <DeleteButton Visible="True">
                </DeleteButton>
                <ClearFilterButton Visible="True">
                </ClearFilterButton>
            </dx:GridViewCommandColumn>
        </Columns>
        <SettingsBehavior ConfirmDelete="True" />
        <Settings ShowPreview="True" />
    </dx:ASPxGridView>
    <dx:XpoDataSource ID="XpoDataSource1" runat="server" DefaultSorting="EditTime DESC"
        TypeName="Aij1.Model.A_Comment">
    </dx:XpoDataSource>
</asp:Content>
